﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;

namespace TestByWire.Test
{
    [TestClass]
    public class TargetInvokerTest
    {
        [TestMethod]
        public void Calling_MustRaiseEvent_WhenTargetIntanceIsCreated()
        {
            var testTargetBuilder = MockRepository.GenerateStub<ITestTargetBuilder>();
            testTargetBuilder.Stub(t => t.InitializeTestTarget()).Return(new Object());
            var targetInvoker = new TargetInvoker<Object, Object>(testTargetBuilder);

            int eventRaisedCount = 0;
            targetInvoker.TestTargetInitialized += (s, a) => eventRaisedCount++;
            var ignore = targetInvoker.Calling;

            Assert.AreEqual(1, eventRaisedCount);
        }
    }
}
